home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 June
/
EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso
/
earcd
/
ead
/
ead07.dms
/
ead07.adf
/
AmigaBasicProgs
/
Lander
< prev
next >
Wrap
Text File
|
1988-07-17
|
15KB
|
459 lines
mode%=1 'mode%=1 production, mode%=0 for debug
'Lunar Lander Game Program
'By: Brian Allston 3/20/86
'
start:
PRINT "Lunar Lander Game"
PRINT "Amiga BASIC version by:"
PRINT "Brian Allston 3/20/86"
PRINT " "
PRINT " "
PRINT " "
a$="Alza il volume per i suoni":LOCATE 8,40-CINT(LEN(a$)/2):PRINT a$
DIM moonscape.h%(641)
SAY ""
RANDOMIZE TIMER
GOSUB initscreen
WIDTH 80
CLS
FOR i=1 TO 22
LOCATE i,i*2+10:PRINT"Lunar Lander"
NEXT i
IF mode%=0 THEN mode%=5
MENU mode%,0,1,"Opzioni"
MENU mode%,1,1,"Start Mission"
MENU mode%,2,1,"Quit "
MENU mode%,3,1,"Help "
IF mode%<>1 THEN GOTO dmsave
MENU 2,0,0,"" 'disable default menus
MENU 3,0,0,""
MENU 4,0,0,""
dmsave:
RESTORE moonscape
FOR i=1 TO 640
READ moonscape.h%(i) 'Input horizon definition
NEXT i
CLS
speech$="Benvenuto a Lunar Lander."
LOCATE 6,40-CINT(LEN(speech$)/2):PRINT speech$
SAY "BEHNVEHNUWTAO AA LUWNAAER LAANDEHER"
speech$="L'oggetto della tua missione e' di fare ":'un perfetto atterraggio nella tua base."
LOCATE 12,40-CINT(LEN(speech$)/2):PRINT speech$
speech$="un perfetto atterraggio sulla tua base"
LOCATE 13,40-CINT(LEN(speech$)/2):PRINT speech$
SAY "LAOGJEHTTAO DEHLLAA TUWAA MIYSSIYAONEH EH DIY FAAEREH UWN PEHERFEHTTAO AATTEHERERAAGJAO SUWLLAA TUWAA BAASEH"
RESTORE lander
ship$=""
FOR i=1 TO 62
READ ship.data%
ship$=ship$+CHR$(ship.data%)
NEXT i
speech$="Devi atterrare velocemente,dolcemente,":'usando meno carburante possibile."
LOCATE 18,40-CINT(LEN(speech$)/2):PRINT speech$
speech$="usando meno carburante possibile"
LOCATE 19,40-CINT(LEN(speech$)/2):PRINT speech$
SAY "DEHVIY AATTEHERERAAEREH VEHLAOCHEHMEHNTEH DAOLCHEHMEHNTEH UWSAANDAO MEHNAO KAAERBUWERAANTEH PAOSSIYBIYLEH"
speech$="Usa il menu' pull-down per partire."
COLOR 1,2:LOCATE 22,40-CINT(LEN(speech$)/2):PRINT speech$;:COLOR 1,0
fg$="UWSAA IYL MEHNUW PPUWLL DDAAUWN PEHER PAAERTIYEREREH"
SAY (fg$)
menucheck:
MENU ON
ON MENU GOSUB getoption
SLEEP
GOTO menucheck
getoption:
OBJECT.OFF
IF MENU(0) <> mode% THEN GOTO nomenu
moption%=MENU(1)
MENU OFF
IF moption%=0 THEN GOTO getoption
ON MENU GOSUB 0
ON moption%+1 GOTO nomenu,main,exit1,showhelp
nomenu:
RETURN
showhelp:
CLS
WINDOW 3,"Mission Objective",(20,20)-(600,130),0,1
WINDOW OUTPUT 3
LOCATE 1,1:COLOR 1,0
PRINT ""
PRINT ""
PRINT ""
PRINT " La tua missione consiste nel pilotare la navicella per atterrare "
PRINT " dolcemente nella base lunare. Usa i controlli sul pannello per"
PRINT " pilotare la navicella con il pulsante sinistro del mouse. "
PRINT " Il punteggio e' determinato dalla velocita',dalla distanza dalla "
PRINT " base,dal carburante usato e dal tempo impiegato."
PRINT ""
PRINT " Buona Fortuna! Brian Allston (76515,1506)"
PRINT ""
PRINT ""
COLOR 1,2:LOCATE 13,15:PRINT "Premi il pulsante sinistro del mouse per continuare.";:COLOR 1,0
keepopen:
IF MOUSE(0)=0 THEN GOTO keepopen
WINDOW OUTPUT 2
WINDOW CLOSE 3
RETURN
main:
GOSUB drawscreen
GOSUB initlander
GOSUB updatedisplay
ON TIMER(.25) GOSUB updatevalues:TIMER ON
'
'Loop until lander touches the horizon
WHILE y&<horizon%
x&=OBJECT.X(1)
IF x&<6 OR x&>620 THEN
IF edgecheck<6 THEN
border=-2
ELSE
border=-4
END IF
GOSUB edge
x&=OBJECT.X(1)
END IF
horizon%=moonscape.h%(x&)
y&=OBJECT.Y(1)+8
GOSUB updatedisplay
WEND
'
'
TIMER OFF
'Check for crash and compute score
OBJECT.STOP 1
computescore:
vterm=SQR(vx*vx+vy*vy)
xterm=ABS(basex-x&):IF xterm>305 THEN xterm=xterm-305
yterm=y-8
IF vterm>vcrash THEN
IF OBJECT.Y(1)>150 THEN OBJECT.Y 1,140
FOR t=1 TO 100:b$=" ":NEXT t
FOR t=1 TO 2
FOR n=400 TO 100 STEP -25
SOUND n,1
NEXT
NEXT
FOR t=1 TO 1000:NEXT t :PRINT "";
yterm=OBJECT.Y(1)+8
xterm=OBJECT.X(1)+5
LINE (xterm,yterm)-(xterm-50,yterm-45),3
LINE (xterm,yterm)-(xterm+50,yterm-50),6
LINE (xterm,yterm)-(xterm-25,yterm-10),6
LINE (xterm,yterm)-(xterm+50,yterm-35),7
LINE (xterm,yterm)-(xterm-10,yterm-60),7
LINE (xterm,yterm)-(xterm+60,yterm-10),3
LINE (xterm,yterm)-(xterm-40,yterm-5),3
LINE (xterm,yterm)-(xterm+20,yterm-30),6
score&=0
landing$="Sei Esploso! Nessun sopravvissuto."
LOCATE 8,40-CINT(LEN(landing$)/2):PRINT landing$
SAY ""
SAY "SEHIY EHSPLAOSAO NEHSSUWN SAOPERERAAVVIYSSUWTTAO "
GOTO displayscore
END IF
landing$="Hai fatto un "
landing1$="AAIY FAATTAO UWN "
IF vterm>vcrash/2 THEN
landing$=landing$+"duro "
landing1$=landing1$+"DUWERAO "
ELSEIF vterm>vcrash/4 THEN
landing$=landing$+"dolce "
landing1$=landing1$+"DAOLCHEH "
ELSE
landing$=landing$+"perfetto "
landing1$=landing1$+"PEHERFEHTTAO "
END IF
score1=score&
landing$=landing$+"atterraggio, "
landing1$=landing1$+"AATTEHERERAAGJAO "
IF xterm>100 THEN
landing$=landing$+"lontano dalla base."
landing1$=landing1$+"LAONTAANAO DAALLAA BAASEH "
ELSEIF xterm>20 THEN
landing$=landing$+"vicino alla base."
landing1$=landing1$+"VIYCHIYNAO AALLAA BAASEH "
ELSE
landing$=landing$+"sulla base. Congratulazioni!"
landing1$=landing1$+"SUWLLAA BAASEH. KAONGERAATUWLAATZIYAONIY "
END IF
score1%=CINT(10*(1-vterm/vcrash))+1
score2%=CINT(15*(1-xterm/310))+1
score3%=CINT(5*fuel/ifuel)+1
score4%=CINT(5/etime)+1
score&=score1%*score2%*score3%*score4%
displayscore:
COLOR 1,0
LOCATE 8,40-CINT(LEN(landing$)/2):PRINT landing$
SAY (landing1$)
LOCATE 11,30:PRINT USING "Your score is: #####";score&
RETURN
'
'Update lander velocity based upon "thrusters"
updatevalues:
etime=etime+(1/120)
vy=vy+gravity
IF fuel=0 THEN GOTO noaccel
mousestat%=MOUSE(0)
mx=MOUSE(1):my=MOUSE(2)
IF mousestat%=0 THEN
IF oldthrust%<>0 THEN GOSUB clearthrust
GOTO noaccel
END IF
mousecheck:
IF mx>=296 AND mx<=325 THEN
IF my>=157 AND my<=170 THEN thrust%=1:vy=vy-2
IF my>=173 AND my<=186 THEN thrust%=2:vy=vy+2
ELSEIF my>=164 AND my<=177 THEN
IF mx>=260 AND mx<=290 THEN thrust%=3:vx=vx-6
IF mx>=331 AND mx<=361 THEN thrust%=4:vx=vx+6
END IF
IF oldthrust%<>thrust% THEN GOSUB clearthrust
IF thrust%=0 THEN GOTO noaccel
showthrust:
COLOR 1,6
IF thrust%=1 THEN LINE (297,158)-(324,169),6,bf:LOCATE 21,39:PRINT "UP";
IF thrust%=2 THEN LINE (297,174)-(324,185),6,bf:LOCATE 23,39:PRINT "DN";
IF thrust%=3 THEN LINE (261,165)-(289,176),6,bf:LOCATE 22,34:PRINT "<-";
IF thrust%=4 THEN LINE (332,165)-(360,176),6,bf:LOCATE 22,43:PRINT "->";
oldthrust%=thrust%
COLOR 1,0
updatefuel:
fuel=fuel-8.3
IF fuel<0 THEN fuel=0
GOTO noaccel
clearthrust:
IF oldthrust%=0 THEN RETURN
COLOR 1,0
IF oldthrust%=1 THEN LINE (297,158)-(324,169),0,bf:LOCATE 21,39:PRINT "UP";
IF oldthrust%=2 THEN LINE (297,174)-(324,185),0,bf:LOCATE 23,39:PRINT "DN";
IF oldthrust%=3 THEN LINE (261,165)-(289,176),0,bf:LOCATE 22,34:PRINT "<-";
IF oldthrust%=4 THEN LINE (332,165)-(360,176),0,bf:LOCATE 22,43:PRINT "->";
oldthrust%=thrust%
RETURN
noaccel:
OBJECT.VX 1,vx
OBJECT.VY 1,vy
OBJECT.START 1
thrust%=0:mousestat%=0
RETURN
'
'Let lander "wrap-around" the left and right borders
wraparound:
border=COLLISION(1)
edge:
IF border=-1 THEN OBJECT.Y 1,1:GOTO restart
IF border=-3 THEN OBJECT.STOP 1:RETURN
IF border=-2 THEN OBJECT.X 1,619:GOTO restart
IF border=-4 THEN OBJECT.X 1,6
restart:
OBJECT.START 1
RETURN
'
'Update Display Values
updatedisplay:
TIMER STOP
COLOR 1,2
LOCATE 21,3:PRINT USING " ####.#";vy*(-17.6);
LOCATE 23,3:PRINT USING " ####.#";vx*5.5;
LOCATE 21,69:PRINT USING " ####.#";(horizon%-y&)*17.6;
LOCATE 23,69:PRINT USING " ####.#";fuel;
COLOR 1,0
TIMER ON
RETURN
'
'Initialize lander position, velocity, and fuel terms
initlander:
gravity=.5
ifuel=400:fuel=ifuel
x&=CINT(RND*610)+5
y&=1
vx=12
IF RND<.5 THEN vx=vx*(-1)
vy=2
vcrash=20
OBJECT.SHAPE 1,ship$
OBJECT.X 1,x&
OBJECT.Y 1,y&
OBJECT.VX 1,vx
OBJECT.VY 1,vy
OBJECT.ON 1
OBJECT.START 1
ON COLLISION GOSUB wraparound
horizon%=moonscape.h%(x&)
COLLISION ON
RETURN
'
'Initialize window and game display
initscreen:
SCREEN 1,640,200,3,2 'Define window parameters
WINDOW 2,"Lunar Lander",,8,1
PALETTE 4,.8,.6,.53 'tan --
PALETTE 5,.33,.87,0 'green | _Additional
PALETTE 6,1,0,0 'red | Colors
PALETTE 7 ,1,1,.13 'yellow --
RETURN
'
drawscreen:
COLOR 1,3 'Draw flight display window
LINE (0,0)-(640,200),3,bf
LINE (5,0)-(625,150),2,bf
FOR i=1 TO 50 'Draw stars
x=INT(RND*620)+5
y=INT(RND*150)
PSET(x,y),1
NEXT i
CIRCLE (580,50),75,0 'draw ringed planet
LINE (5,0)-(625,150),0,b
CIRCLE (580,50),85,0,2.6,6,1/12
CIRCLE (580,50),110,0,2.25,6,1/12
CIRCLE (580,50),150,0,2.05,6,1/12
PAINT (494,50),7,0
PAINT (580,58),7,0
PAINT (465,50),6,0
PAINT (580,60),6,0
PAINT (580,50),0
PAINT (580,70),0
CIRCLE (580,50),85,2,2.65,6,1/12
CIRCLE (580,50),110,2,2.3,6,1/12
CIRCLE (580,50),150,2,2.08,6,1/12
'
LINE (625,0)-(640,150),3,bf 'draw horizon
LINE (625,150)-(5,150),4
LINE (5,150)-(5,126),4
LINE (5,126)-(25,138),4
LINE (25,138)-(60,138),4
LINE (60,138)-(70,144),4
LINE (70,144)-(80,144),4
LINE (80,144)-(120,120),4
LINE (120,120)-(140,100),4
LINE (140,100)-(360,130),4
LINE (360,130)-(500,130),4
LINE (500,130)-(550,145),4
LINE (550,145)-(625,136),4
LINE (625,136)-(625,150),4
PAINT (6,148),4 'paint moonscape
'CIRCLE (20,140),7,2,1/25
'CIRCLE (130,130),15,2,1/25
LINE (5,0)-(625,150),2,b 'cover planet edge
'
basex=CINT(RND*600)+5 'randomly position base
basey=moonscape.h%(basex)
LINE (basex,basey)-STEP(15,6),6,bf
LINE (basex+1,basey-20)-STEP(13,22),2,bf
'
COLOR 1,3: 'Draw Instrument Panel
LOCATE 20,3:PRINT "V-SPEED";
LOCATE 22,3:PRINT "H-SPEED";
LOCATE 20,69:PRINT "Altitude";
LOCATE 22,69:PRINT " Fuel ";
LINE (10,160)-(80,167),2,bf
LINE (10,176)-(80,184),2,bf
LINE (540,160)-(610,167),2,bf
LINE (540,176)-(610,184),2,bf
LINE (296,157)-(325,170),0,bf
LINE (296,173)-(325,186),0,bf
LINE (260,164)-(290,177),0,bf
LINE (331,164)-(361,177),0,bf
COLOR 1,0
LOCATE 21,39:PRINT "UP";
LOCATE 22,34:PRINT "<-";
LOCATE 22,43:PRINT "->";
LOCATE 23,39:PRINT "DN";
LINE (296,157)-(325,170),2,b
LINE (296,173)-(325,186),2,b
LINE (260,164)-(290,177),2,b
LINE (331,164)-(361,177),2,b
RETURN
'
'End of program clean-up
exit1:
TIMER OFF
COLLISION OFF
WINDOW CLOSE 1
MENU OFF
MENU RESET
OBJECT.OFF
SYSTEM
'
moonscape:
DATA 126, 126, 126, 126, 126, 127, 127, 128, 128, 129
DATA 130, 130, 131, 131, 132, 133, 133, 134, 134, 135
DATA 136, 136, 137, 137, 138, 138, 138, 138, 138, 138
DATA 138, 138, 138, 138, 138, 138, 138, 138, 138, 138
DATA 138, 138, 138, 138, 138, 138, 138, 138, 138, 138
DATA 138, 138, 138, 138, 138, 138, 138, 138, 138, 138
DATA 139, 139, 140, 140, 141, 142, 142, 143, 143, 144
DATA 144, 144, 144, 144, 144, 144, 144, 144, 144, 144
DATA 143, 143, 142, 142, 141, 140, 140, 139, 139, 138
DATA 137, 137, 136, 136, 135, 134, 134, 133, 133, 132
DATA 131, 131, 130, 130, 129, 128, 128, 127, 127, 126
DATA 125, 125, 124, 124, 123, 122, 122, 121, 121, 120
DATA 119, 118, 117, 116, 115, 114, 113, 112, 111, 110
DATA 109, 108, 107, 106, 105, 104, 103, 102, 101, 100
DATA 100, 100, 100, 101, 101, 101, 101, 101, 101, 101
DATA 102, 102, 102, 102, 102, 102, 102, 102, 103, 103
DATA 103, 103, 103, 103, 103, 104, 104, 104, 104, 104
DATA 104, 104, 105, 105, 105, 105, 105, 105, 105, 105
DATA 106, 106, 106, 106, 106, 106, 106, 107, 107, 107
DATA 107, 107, 107, 107, 108, 108, 108, 108, 108, 108
DATA 108, 108, 109, 109, 109, 109, 109, 109, 109, 110
DATA 110, 110, 110, 110, 110, 110, 111, 111, 111, 111
DATA 111, 111, 111, 111, 112, 112, 112, 112, 112, 112
DATA 112, 113, 113, 113, 113, 113, 113, 113, 114, 114
DATA 114, 114, 114, 114, 114, 114, 115, 115, 115, 115
DATA 115, 115, 115, 116, 116, 116, 116, 116, 116, 116
DATA 116, 117, 117, 117, 117, 117, 117, 117, 118, 118
DATA 118, 118, 118, 118, 118, 119, 119, 119, 119, 119
DATA 119, 119, 119, 120, 120, 120, 120, 120, 120, 120
DATA 121, 121, 121, 121, 121, 121, 121, 122, 122, 122
DATA 122, 122, 122, 122, 122, 123, 123, 123, 123, 123
DATA 123, 123, 124, 124, 124, 124, 124, 124, 124, 125
DATA 125, 125, 125, 125, 125, 125, 125, 126, 126, 126
DATA 126, 126, 126, 126, 127, 127, 127, 127, 127, 127
DATA 127, 128, 128, 128, 128, 128, 128, 128, 128, 129
DATA 129, 129, 129, 129, 129, 129, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 130, 130, 130, 130, 130, 130, 130, 130, 130
DATA 130, 131, 131, 131, 132, 132, 132, 132, 133, 133
DATA 133, 134, 134, 134, 134, 135, 135, 135, 136, 136
DATA 136, 137, 137, 137, 138, 138, 138, 138, 139, 139
DATA 139, 140, 140, 140, 140, 141, 141, 141, 142, 142
DATA 142, 143, 143, 143, 144, 144, 144, 144, 145, 145
DATA 145, 145, 144, 144, 144, 143, 143, 143, 143, 142
DATA 142, 142, 142, 141, 141, 141, 141, 140, 140, 140
DATA 140, 139, 139, 139, 139, 138, 138, 138, 138, 137
DATA 137, 137, 137, 136, 136, 136, 136, 135, 135, 135
DATA 135, 134, 134, 134, 134, 133, 133, 133, 133, 132
DATA 132, 132, 132, 131, 131, 131, 131, 130, 130, 130
DATA 130, 129, 129, 129, 129, 128, 128, 128, 128, 127
DATA 127, 127, 127, 126, 126, 126, 126, 126, 126, 126
DATA 126, 126, 126, 126, 126, 126, 126, 126, 126, 126
'
lander:
DATA 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 2, 0, 0, 0, 11, 0, 0, 0, 9
DATA 0, 24, 0, 3, 0, 0, 4, 0, 14, 0
DATA 10, 0, 10, 0, 10, 0, 31, 0, 31, 0
DATA 63, 128, 64, 64, 0, 0, 0, 0, 4, 0
DATA 4, 0, 4, 0, 14, 0, 14, 0, 0, 0
DATA 0, 0
'
END